#include <alibabacloud/oss/OssClient.h>
#include <string>
using namespace std;
using namespace AlibabaCloud::OSS;

struct OSSInfo{
    string AccesskeyID = "LTAI5tN35oRk8yCK7EvF5778";
    string AccesskeySecret = "iOxqDwafaGRBaOWg9RliaB2ow7zyto";
    string EndPoint = "oss-cn-beijing.aliyuncs.com";
    string Bucket = "qingliu-test";
};// 保存自己的用户信息

int main(){
    InitializeSdk();
    OSSInfo info;
    ClientConfiguration conf; // 默认构造一个ClientConfiguration
    OssClient ossClient(info.EndPoint, info.AccesskeyID, info.AccesskeySecret, conf); // 构造一个ossClient对象

    time_t now = time(nullptr);
    StringOutcome outcome = ossClient.GeneratePresignedUrl(info.Bucket, "dir1/2.txt", now + 600, Http::Get);
    if(outcome.isSuccess()){
        cout << "Success! URL = " << outcome.result() << endl;
    } else {
        cout << "Failed! Message = " << outcome.error().Message() << endl;
    }
    ShutdownSdk();
    return 0;
}